home *** CD-ROM | disk | FTP | other *** search
- Path: uu4news.netcom.com!dodge!news
- From: Deepak Goel <Deepak.Goel@siemensrolm.com>
- Newsgroups: comp.lang.c++
- Subject: Re: main()
- Date: Wed, 17 Apr 1996 09:17:34 -0700
- Organization: Siemens Rolm Communications Inc.
- Message-ID: <3175199E.4690@siemensrolm.com>
- References: <3174c0dc.7652220@news.flex.com.au>
- NNTP-Posting-Host: argonne.eng.sc.rolm.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (WinNT; I)
-
- Tony L wrote:
- >
- > Hi all,
- >
- > I have come across two different ways that 2 different beginners books
- > recommend that every program should start. Could someone please tell
- > me which one is the "BEST" or proper way?
- >
- > #include <stdio.h>
- > void main()
- > {
- > printf("Hello!\n");
- > return 0;
- > }This one is certainly wrong because void return type means that
- function doesn't return any value and you are (should also).
- >
- > Or, the same as above but not include "void":
- >
- > #include <stdio.h>
- > main()
- > {
- > printf("Hello!\n");
- > return 0;
- > }This is the right approach but this has an implicit return type
- of 'int'. Instead you should have something like this
- int main()
- >
- > As I am just really starting out in "C", I'd like to get off to the
- > right way. :-)
- >
- > Thank you very much for your time....
- >
- > Regards,
- > TonyL....
- >
- > cobweb@flex.com.au
-